using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace OnlineAnadolu
{
    public partial class AnadoluBazaar1 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            string query = "SELECT [username], [password] FROM [users] WHERE (([user_name] = N'" + Login1.UserName + "') and issubscribed=1)";
            SqlConnection con2 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["shoppingConnectionString"].ToString());
            SqlCommand cmd2 = new SqlCommand(query, con2);
            SqlDataAdapter ad2 = new SqlDataAdapter(cmd2);
            DataTable dt2 = new DataTable();
            ad2.Fill(dt2);
            foreach (DataRow dr in dt2.Rows)
            {
                if (dr["password"].ToString() == Login1.Password)
                {
                    Session["username"] = Login1.UserName;
                    Response.Redirect("AnaSayfa.aspx");
                }
            }
        }
    }
}
